<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
    <!-- Bootstrap CSS -->
    <link crossorigin="anonymous" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
          integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" rel="stylesheet">
    <title>Django书签 | {% block title %}{% endblock %}</title>

    {% load static %}
    <link rel="stylesheet" href="{% static 'css/main.css' %}">

</head>
<body>

<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top shadow-sm">
    <div class="container">

        <a class="navbar-brand" href="{% url 'bookmark_list' %}">首页</a>
        <button aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler"
                data-target="#navbarNav" data-toggle="collapse" type="button">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'tag_cloud' %}">标签云</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'popular_bookmarks' %}">热门书签</a>
                </li>
            </ul>
            <ul class="navbar-nav ml-auto">
                {% if user.is_authenticated %}
                <li class="nav-item dropdown">
                    <a aria-expanded="false" aria-haspopup="true" class="nav-link dropdown-toggle" data-toggle="dropdown"
                       href="#" id="navbarDropdown" role="button">
                        {{ user.username }}
                    </a>
                    <div aria-labelledby="navbarDropdown" class="dropdown-menu">
                        <a class="dropdown-item" href="{% url 'account_profile' %}">我的主页</a>
                        <a class="dropdown-item" href="{% url 'new_bookmark' %}">建书签</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{% url 'account_logout' %}">注销</a>
                        <a class="dropdown-item" href="{% url 'account_change_password' %}">更改密码</a>
                        <a class="dropdown-item" href="{% url 'account_settings' %}">设置</a>
                    </div>
                </li>
                {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'account_login' %}">登录</a>
                </li>
                {% endif %}

            </ul>
        </div>
    </div>
</nav>
<div class="container mt-4">
    {% if messages %}
    {% for message in messages %}
        <div class="alert alert-{{ message.tags }} alert-dismissable fade show" role="alert">
            {{ message }}
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
    {% endfor %}
    {% endif %}

    {% block content %}{% endblock %}
</div>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script crossorigin="anonymous"
        integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
        src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script crossorigin="anonymous"
        integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
        src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script crossorigin="anonymous"
        integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
        src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
</body>
</html>